package xinxin.com.FactoryMethodPattern;

import xinxin.com.FactoryMethodPattern.Factory.FactoryDetail.PowFactory;
import xinxin.com.FactoryMethodPattern.Factory.IFactory;
import xinxin.com.FactoryMethodPattern.Operation.Operation;

public class FactoryMethodPattern {
    public static void main(String[] args) {
        IFactory operFactory = new PowFactory();
        Operation oper = operFactory.CreateOperation();
        oper.set_numberA(2);
        oper.set_numberB(5);
        double result;
        try {
            result = oper.GetResult();
            System.out.print("结果为：");
            System.out.println(result);
        } catch (Exception e) {
            System.out.println("输入格式有误！");
        }
    }
}
